$time-column-width: 3em;
$week-numbers-width: 3em;
$time-column-width-12: 4em; // twelve-hour clock shows am/pm.
$weekdays-headings-height: 2.8em;
$weekdays-headings-height-with-splits: 3.4em;
$splits-headers-height: 1.5em;

.vuecal {
  height: 100%;
  box-shadow: 0 0 0 1px inset rgba(0, 0, 0, 0.08);

  // Disable user selection everywhere except in events.
  * {user-select: none;}

  // General.
  //==================================//
  .clickable {cursor: pointer;}

  &--resizing-event {cursor: ns-resize;}
  &--dragging-event {
    cursor: move;
    cursor: -webkit-grabbing;
    cursor: grabbing;
  }

  .dragging-helper {
    position: absolute;
    width: 60px;
    height: 40px;
    background: rgba(138, 190, 230, 0.8);
    border: 1px solid #61a9e0;
    z-index: 10;
    // transition: 0.2s transform;
  }

  &--xsmall {font-size: 0.9em;}

  &__flex {
    display: flex;
    flex-direction: row;

    &[column] {
      flex-direction: column;
      flex: 1 1 auto;
    }

    &[grow] {
      flex: 1 1 auto;
      width: 100%;
    }

    &[wrap] {
      flex-wrap: wrap;
    }
  }

  // Calendar header.
  //==================================//
  &__split-days-headers {
    &.slide-fade--right-leave-active {display: none;}

    .vuecal--week-numbers.vuecal--month-view & {margin-left: $week-numbers-width;}
    .vuecal--day-view:not(.vuecal--overflow-x) & {margin-left: $time-column-width;height: 2.2em;}
    .vuecal--day-view.vuecal--twelve-hour:not(.vuecal--overflow-x) & {margin-left: $time-column-width-12;}

    .day-split-header {display: flex;flex-grow: 1;justify-content: center;}

    .vuecal--day-view.vuecal--overflow-x.vuecal--sticky-split-labels .day-split-header {height: $splits-headers-height;}
  }

  // Calendar body.
  //==================================//
  &__body {
    position: relative;
    overflow: hidden;
  }

  &__all-day {
    min-height: 1.7em;
    margin-bottom: -1px;
    flex-shrink: 0;

    > span {
      width: $time-column-width;
      box-sizing: border-box;
      color: #999;
      padding-right: 2px;
      display: flex;
      flex-shrink: 0;
      align-items: center;
      justify-content: flex-end;
      border-bottom: 1px solid #ddd;
      hyphens: auto;

      span {
        font-size: 0.85em;
        text-align: right;
        line-height: 1.1;
      }
    }
    .vuecal--twelve-hour & > span {width: $time-column-width-12;}
  }

  &__bg {
    overflow: auto;
    overflow-x: hidden; // Prevent horizontal scroll bar while transitioning.
    -webkit-overflow-scrolling: touch;
    min-height: 60px;
    position: relative;
    width: 100%;
    margin-bottom: 1px;
  }

  &--no-time &__bg {
    display: flex;
    flex: 1 1 auto;
    overflow: auto;
  }

  &__week-numbers {
    width: $week-numbers-width;
    flex-shrink: 0 !important;

    .vuecal__week-number-cell {
      opacity: 0.4;
      font-size: 0.9em;
      align-items: center;
      justify-items: center;
      justify-content: center;
    }
  }

  &__scrollbar-check {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: scroll;
    visibility: hidden;
    z-index: -1;

    & div {height: 120%;}
  }

  &__time-column {
    width: $time-column-width;
    height: 100%;
    flex-shrink: 0;

    .vuecal--twelve-hour & {
      width: $time-column-width-12;
      font-size: 0.9em;
    }

    .vuecal--overflow-x.vuecal--week-view & {
      margin-top: $weekdays-headings-height;
      box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
    }

    .vuecal--overflow-x.vuecal--week-view.vuecal--sticky-split-labels & {
      margin-top: $weekdays-headings-height-with-splits;
    }
    .vuecal--overflow-x.vuecal--day-view.vuecal--sticky-split-labels & {margin-top: $splits-headers-height;}

    .vuecal__time-cell {
      color: #999;
      text-align: right;
      padding-right: 2px;
      font-size: 0.9em;
    }

    .vuecal__time-cell-line:before {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      border-top: 1px solid rgba(196, 196, 196, 0.3);
    }
  }

  // Calendar cells.
  //==================================//
  &__cells {
    margin: 0 1px 1px 0;
    .vuecal--overflow-x.vuecal--day-view & {margin: 0;}

    .vuecal--events-on-month-view.vuecal--short-events & {width: 99.9%;}

    .vuecal--overflow-x.vuecal--day-view &,
    .vuecal--overflow-x.vuecal--week-view & {
      flex-wrap: nowrap;
      overflow: auto;
    }
  }
}

// Transitions.
//==================================//
.slide-fade--left-enter-active, .slide-fade--left-leave-active,
.slide-fade--right-enter-active, .slide-fade--right-leave-active {
  transition: 0.25s ease-out;
}

.slide-fade--left-enter,
.slide-fade--right-leave-to {
  transform: translateX(-15px);
  opacity: 0;
}

.slide-fade--left-leave-to,
.slide-fade--right-enter {
  transform: translateX(15px);
  opacity: 0;
}

.slide-fade--left-leave-active,
.slide-fade--right-leave-active {position: absolute !important;height: 100%;}
.vuecal__title-bar .slide-fade--left-leave-active,
.vuecal__title-bar .slide-fade--right-leave-active {left: 0;right: 0;height: auto;}
.vuecal__heading .slide-fade--left-leave-active,
.vuecal__heading .slide-fade--right-leave-active {display: flex;align-items: center;}

// Themes.
//==================================//
.vuecal--green-theme {
  .vuecal__menu, .vuecal__cell-events-count {background-color: #42b983;color: #fff;}
  .vuecal__title-bar {background-color: #e4f5ef;}
  .vuecal__cell--today, .vuecal__cell--current {background-color: rgba(240, 240, 255, 0.4);}
  &:not(.vuecal--day-view) .vuecal__cell--selected {background-color: rgba(235, 255, 245, 0.4);}
  .vuecal__cell--selected:before {border-color: rgba(66, 185, 131, 0.5);}
  .vuecal__cell--highlighted:not(.vuecal__cell--has-splits),
  .vuecal__cell-split--highlighted {background-color: rgba(195, 255, 225, 0.5);}
  .vuecal__arrow--highlighted,
  .vuecal__today-btn--highlighted,
  .vuecal__view-btn--highlighted {background-color: rgba(136, 236, 191, 0.25);}
}

.vuecal--blue-theme {
  .vuecal__menu, .vuecal__cell-events-count {background-color: rgba(66, 163, 185, 0.8);color: #fff;}
  .vuecal__title-bar {background-color: rgba(0, 165, 188, 0.3);}
  .vuecal__cell--today, .vuecal__cell--current {background-color: rgba(240, 240, 255, 0.4);}
  &:not(.vuecal--day-view) .vuecal__cell--selected {background-color: rgba(235, 253, 255, 0.4);}
  .vuecal__cell--selected:before {border-color: rgba(115, 191, 204, 0.5);}
  .vuecal__cell--highlighted:not(.vuecal__cell--has-splits),
  .vuecal__cell-split--highlighted {background-color: rgba(0, 165, 188, 0.06);}
  .vuecal__arrow--highlighted,
  .vuecal__today-btn--highlighted,
  .vuecal__view-btn--highlighted {background-color: rgba(66, 163, 185, 0.2);}
}

// Rounded cells.
.vuecal--rounded-theme {
  .vuecal__weekdays-headings {border: none;}
  .vuecal__cell, &:not(.vuecal--day-view) .vuecal__cell:before {background: none;border: none;}
  .vuecal__cell.out-of-scope {opacity: 0.4;}
  .vuecal__cell-content {
    width: 30px;
    height: 30px;
    flex-grow: 0;
    border: 1px solid transparent;
    border-radius: 30px;
    color: #333;
  }
  &.vuecal--day-view .vuecal__cell-content {width: auto;background: none;}
  &.vuecal--year-view .vuecal__cell {width: 33.33%;}
  &.vuecal--year-view .vuecal__cell-content {width: 85px;}
  &.vuecal--years-view .vuecal__cell-content {width: 52px;}
  .vuecal__cell {background-color: transparent !important;}

  &.vuecal--green-theme {
    &:not(.vuecal--day-view) .vuecal__cell-content {background-color: #f1faf7;}
    &:not(.vuecal--day-view) .vuecal__cell--today .vuecal__cell-content {background-color: #42b983;color: #fff;}
    .vuecal--day-view .vuecal__cell--today:before {background-color: rgba(66, 185, 131, 0.05);}
    &:not(.vuecal--day-view) .vuecal__cell--selected .vuecal__cell-content {border-color: #42b983;}
    .vuecal__cell--highlighted:not(.vuecal__cell--has-splits),
    .vuecal__cell-split--highlighted {background-color: rgba(195, 255, 225, 0.5);}
  }

  &.vuecal--blue-theme {
    &:not(.vuecal--day-view) .vuecal__cell-content {background-color: rgba(100, 182, 255, 0.2);}
    &:not(.vuecal--day-view) .vuecal__cell--today .vuecal__cell-content {background-color: #8fb7e4;color: #fff;}
    .vuecal--day-view .vuecal__cell--today:before {background-color: rgba(143, 183, 228, 0.1);}
    &:not(.vuecal--day-view) .vuecal__cell--selected .vuecal__cell-content {border-color: #61a9e0;}
    .vuecal__cell--highlighted:not(.vuecal__cell--has-splits),
    .vuecal__cell-split--highlighted {background-color: rgba(0, 165, 188, 0.06);}
  }
}
